import request from '@/router/axios';
import {downloadExcel} from '@/router/axios';
import {formatCondition} from '@/util/util';
//立即下发问卷
export const sendQuestionNow = (params) => {
  params.head.transCode = 'sendQuestionNow';
  return request({
    url: '/biz/question/bizQuestionTemplate/sendQuestionNow',
    method: 'post',
    data: params
  })
}

//单条查询
export const queryBizQuestionTemplate = (params) => {
  params.head.transCode = 'queryBizQuestionTemplate';
  return request({
    url: '/biz/question/bizQuestionTemplate/queryBizQuestionTemplate',
    method: 'post',
    data: params
  })
}
//多条列表查询，支持条件查询
export const queryBizQuestionTemplateListPage = (params) => {
  params.head.transCode = 'queryBizQuestionTemplateListPage';
  return request({
    url: '/biz/question/bizQuestionTemplate/queryBizQuestionTemplateListPage',
    method: 'post',
    data: params
  })
}
//新增单条记录  
export const saveBizQuestionTemplate = (params) => {
  params.head.transCode = 'saveBizQuestionTemplate';
  return request({
    url: '/biz/question/bizQuestionTemplate/saveBizQuestionTemplate',
    method: 'post',
    data: params
  })
}
//新增多条记录
export const saveBizQuestionTemplateList = (params) => {
  params.head.transCode = 'saveBizQuestionTemplateList';
  return request({
    url: '/biz/question/bizQuestionTemplate/saveBizQuestionTemplateList',
    method: 'post',
    data: params
  })
}
//新增或修改单条记录
export const saveOrUpdateBizQuestionTemplate = (params) => {
  params.head.transCode = 'saveOrUpdateBizQuestionTemplate';
  return request({
    url: '/biz/question/bizQuestionTemplate/saveOrUpdateBizQuestionTemplate',
    method: 'post',
    data: params
  })
}


//新增或修改单条记录
export const saveOrUpdateBizQuestionTemplateList = (params) => {
  params.head.transCode = 'saveOrUpdateBizQuestionTemplateList';
  return request({
    url: '/biz/question/bizQuestionTemplate/saveOrUpdateBizQuestionTemplateList',
    method: 'post',
    data: params
  })
}

//修改单条记录
export const updateBizQuestionTemplate = (params) => {
  params.head.transCode = 'updateBizQuestionTemplate';
  return request({
    url: '/biz/question/bizQuestionTemplate/updateBizQuestionTemplate',
    method: 'post',
    data: params
  })
}

//删除单条记录
export const deleteBizQuestionTemplate = (params) => {
  params.head.transCode = 'deleteBizQuestionTemplate';
  return request({
    url: '/biz/question/bizQuestionTemplate/deleteBizQuestionTemplate',
    method: 'post',
    data: params
  })
}

//删除多条记录
export const deleteBizQuestionTemplateList = (params) => {
  params.head.transCode = 'deleteBizQuestionTemplateList';
  return request({
    url: '/biz/question/bizQuestionTemplate/deleteBizQuestionTemplateList',
    method: 'post',
    data: params
  })
}
//导出excel
export const exportBizQuestionTemplateExcel = (params) => {
  downloadExcel({
    url: '/biz/question/bizQuestionTemplate/excelDownload/exportBizQuestionTemplateExcel',
    method: 'get',
    data: 
    {
      tenantId: params.head.tenantId,
      orders:'',
      condition: formatCondition(params.body.sqlCondition)
    }
  })
}
